package com.ranjiaqi.file;

/**
 * @ClassName GetSum
 * @Description TODO
 * @Author hp
 * @Date 2021/7/1 10:17
 * @Version 1.0
 **/
public class GetSum {
    public static void main(String[] args) {
        System.out.println("getSum = " + getSum(3));
    }
    public static int getSum(int num){
        if (num == 1)
            return 1;
        else {
            return getSum(num-1)+num;
        }
    }
}
